#pragma once

#define AGV_BUFF_LEN	3																		// 线段缓存区长度
#define MAIN_TICK		50.0

#define PNT_MAX			9999
#define SEG_MAX			9999

#define PI			3.14159265358979323846														// PI 定义
#define PI_001		0.000174532925199432957692													// PI / 18000 定义
#define PI_1		0.0174532925199432957692													// PI / 180 定义
#define PI_30		0.52359877559829887308														// PI / 6 定义
#define PI_60		1.04719755119659774615														// PI / 3 定义
#define PI_90		1.57079632679489661923														// PI / 2 定义
#define PI_360		6.28318530717958647692														// PI / 2 定义

struct st_pnt																				// 点属性结构体
{
	int id, x, y, offset;
	double z;
};

struct st_seg																				// 线段属性结构体
{
	int id, p1, p2, max_v, cp, offset;
	bool b_backward, b_bypass_lsu, b_alarm, b_led_left, b_led_right;

	struct st_p
	{
		double x, y;
	} p[];
};


typedef int(*callback_tick)(void);
typedef void(*callback_can_recv)(void *_rx_buff, int _rx_len);

typedef int(*type_subscribe_int)(const char *v_name, int &x);
typedef int(*type_subscribe_float)(const char *v_name, float &x);
typedef int(*type_subscribe_bool)(const char *v_name, bool &x);

typedef int(*type_run_server_trig)(callback_tick _tick);
typedef int(*type_run_cycle)(callback_tick _tick, int sleep_ms);
typedef int(*type_run_once)(callback_tick _tick);
typedef void(*type_run_void)(void);

typedef int(*type_log_send)(const char *_format, ...);
typedef int(*type_error_send)(int _type, const char *_format, ...);
typedef void(*type_dispose)(void);

typedef int(*type_c_pnt)(void);
typedef int(*type_c_seg)(void);

typedef st_pnt *(*type_pnt_o)(int _idx);
typedef st_seg *(*type_seg_o)(int _idx);

typedef st_pnt *(*type_pnt)(int _idx);
typedef st_seg *(*type_seg)(int _idx);
typedef st_seg *(*type_seg_quiet)(int _idx);

typedef int(*type_route)(int p1, int p2);
typedef long(*type_get_ts_tick)(void);

typedef void(*type_can_init)(int _node_id, callback_can_recv _can_recv);
typedef void(*type_can_send)(void *_frame);
